package com.example.chapter04;


import static com.example.chapter04.RangeMethods.range;

/**
 * 4.for-in 语法
 * @date 2024/4/29
 */
public class Forlnlnt {
    public static void main(String[] args) {
        for(int i : range(10)) {// 0-9
            System.out.print(i+" ");
        }

        System.out.println();
        for(int i : range(5, 10)) {// 5~9
            System.out.print(i+" ");
        }

        System.out.println();
        for(int i : range(5, 20, 3)) {// 5-20,步进 3
            System.out.print(i+" ");
        }
        System.out.println();
        for(int i : range(20, 5, -3)) {// 倒计时
            System.out.print(i+" ");
        }
        System.out.println();
    }

}

